package com.mmc.web.controller.test;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mmc.domain.User;
import com.mmc.service.UserService;
import com.mmc.web.controller.base.BaseController;
@Controller
@RequestMapping("/user")
public class UserController extends BaseController{
	@Autowired
	private UserService userService;
	
	private List<User> users = new ArrayList<User>();
	@RequestMapping(value="/getUser.action")
	@ResponseBody
	public List<User> getUserByUserName(String username){
	    users = userService.getUserByUserName(username);
		System.out.println(users);
		
		return users;
	}
	
	@RequestMapping(value="/getUser1.action")
	public String getUserByUserName1(String username){
	    users = userService.getUserByUserName(username);
		System.out.println(users);
		model.addAttribute("users", users);
		return "/test/result.jsp";
	}
	public List<User> getUsers() {
		return users;
	}
	public void setUsers(List<User> users) {
		this.users = users;
	}
	
	
}
